﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.SheepAblactationCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.SheepAblactationCommandHandler
{
    /// <summary>
    /// 种母断奶删除
    /// </summary>
    public class DelSheepAblacationsCommandHandler : IRequestHandler<DelSheepAblacationsCommand, Results<int>>
    {
        private readonly ISheepAblactationService _sheepAblactationService;

        public DelSheepAblacationsCommandHandler(ISheepAblactationService sheepAblactationService)
        {
            _sheepAblactationService = sheepAblactationService;
        }

        public async Task<Results<int>> Handle(DelSheepAblacationsCommand request, CancellationToken cancellationToken)
        {
            var result = await _sheepAblactationService.DelSheepAblacations(request.userId, request.ids);
            return Results<int>.DataResult(result);
        }
    }
}
